"""
生成测试报告
"""
import logging
import unittest
from htmltestreport import HTMLTestReport

from common.logging_use import init_logging
from config import BASE_OIR
from scripts.test_ihrm_login_params import TestIhrmLoginParams
from scripts.test_emp_add_params import TestEmpAddParams
from scripts.test_emp_query import TestEmpQuery
from scripts.test_emp_modify import TestEmpModify
from scripts.test_emp_delete import TestEmpDelete

# 初始化测试套件实例
init_logging(BASE_OIR+"/log/ihrm.log")

# 创建测试套件实例
suite=unittest.TestSuite()

logging.info("创建测试套件实例成功！")

# 添加测试类，组装测试用例
suite.addTest(unittest.makeSuite(TestIhrmLoginParams))
suite.addTest(unittest.makeSuite(TestEmpAddParams))
suite.addTest(unittest.makeSuite(TestEmpQuery))
suite.addTest(unittest.makeSuite(TestEmpModify))
suite.addTest(unittest.makeSuite(TestEmpDelete))

# 创建HTMLTestReport实例
runner=HTMLTestReport("./report/ihrmTest.html",
                      description="围绕IHRM后台管理系统进行登录和员工管理模块的接口测试",
                      title="IHRM测试报告")

# 调用run(),传入suite
runner.run(suite)
logging.info("创建ihrmTest.html成功！")
